from coin.strategy.hk_lm.lm_pass_logic import LmPassThinBookLogic as LmPassThinBookLogicLive
from coin.strategy.hk_lm.lm_pass_logic import LmPassThickBookLogic as LmPassThickBookLogicLive
from coin.strategy.hk_lm.lm_pass_logic import LmPassPricerLogic as LmPassPricerLogicLive


class LmPassThinBookLogic(LmPassThinBookLogicLive):
  def get_misc_info(self):
    return None

  def try_fire_and_manage(self, *, timestamp, executor, feed_converter, model, book, dry_run):
    executor.set_timestamp(timestamp)
    executor._update_state(timestamp)
    if executor._position is None:
      return
    self.try_fire_impl(timestamp=timestamp,
                       executor=executor,
                       feed_converter=feed_converter,
                       model=model,
                       book=book,
                       dry_run=dry_run)
    self.manage_orders(executor=executor, timestamp=timestamp)


class LmPassThickBookLogic(LmPassThickBookLogicLive):
  def get_misc_info(self):
    return None

  def try_fire_and_manage(self, *, timestamp, executor, feed_converter, model, book, dry_run):
    executor.set_timestamp(timestamp)
    executor._update_state(timestamp)
    if executor._position is None:
      return
    self.try_fire_impl(timestamp=timestamp,
                       executor=executor,
                       feed_converter=feed_converter,
                       model=model,
                       book=book,
                       dry_run=dry_run)
    self.manage_orders(executor=executor, timestamp=timestamp)


class LmPassPricerLogic(LmPassPricerLogicLive):
  def get_misc_info(self):
    return None

  def try_fire_and_manage(self, *, timestamp, executor, feed_converter, model, book, dry_run):
    executor.set_timestamp(timestamp)
    executor._update_state(timestamp)
    if executor._position is None:
      return
    self.try_fire_impl(timestamp=timestamp,
                       executor=executor,
                       feed_converter=feed_converter,
                       model=model,
                       book=book,
                       dry_run=dry_run)
    self.manage_orders(executor=executor, timestamp=timestamp)
